import 'package:flutter/material.dart';
import 'package:test_app/core/design_system/extensions/extensions.dart';
import 'package:test_app/core/design_system/theme/color.dart';

class LayoutView extends StatelessWidget {

  /// 标题
  final String title;

  /// 描述
  final String description;

  /// 图标
  final IconData icon;

  /// 点击事件
  final VoidCallback? onTap;

  const LayoutView({
    super.key,
    required this.title,
    required this.description,
    required this.icon,
    this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      child: [
        [
          [
            Icon(icon).iconSize(16).padRight(10),
            Text(title).textColor(textPrimary)
          ].toRow(),
          Text(description).textColor(textSecondary)
        ].toColumnStart(),
        Text('查看').textColor(success)
      ].toRowBetween().padAll(10)
    )
        .animatedTapScale(onTap ?? () => {}, color: Color(0xD5B7FFB9))
        .backgroundColor(Color(0xD5B7FFB9)).border(all: 1, color: Color(0xD57FB883), radius: 10);
  }
}